package com.itfenghuang.day03;

import java.util.Objects;

public class A01_方法参数 {
    public static void main(String[] args) {
        //本类中调用本类的方法,直接调用,在不同的类中调用方法才会创建对象
        //静态资源中不能直接去访问非静态资源
        method1("提莫",666);

        Student student = new Student("爆爆",15);
        student.printStudent();

        print(student);
    }
    public static void method1(String name, int age){
        System.out.println(name+"队长"+age);
    }

    public static void print(Student student){
        System.out.println(student.getName()+student.getAge());
    }
}
class Student{
    private String name;
    private int age;

    public  void  printStudent(){
        System.out.println(name+age);
    }

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age &&
                Objects.equals(name, student.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}